<template>
  <basic-container>
    <el-row>
      <el-col :span="4" style="padding: 10px">
        <el-tabs type="border-card">
          <el-tab-pane label="检验项列表">
            <!-- <div style="color: rgb(28, 138, 254); font-size: 12px">检验项列表</div> -->
            <div class="icon-inspection-item">
              <el-button class="refresh-btn inspection-btn" size="small" icon="el-icon-refresh" @click="refreshInspection"></el-button>
              <el-button v-if="permission.inspection_add" class="add-btn inspection-btn" size="small" icon="el-icon-plus" @click="addInspection"></el-button>
              <el-button
                v-if="permission.inspection_edit"
                :disabled="!itemId"
                class="inspection-btn"
                :class="itemId ? 'edit-btn' : 'btn-disabled'"
                size="small"
                icon="el-icon-edit"
                @click="updateInspection"
              ></el-button>
              <el-button
                v-if="permission.inspection_del"
                :disabled="!itemId"
                class="inspection-btn"
                :class="itemId ? 'del-btn' : 'btn-disabled'"
                size="small"
                icon="el-icon-close"
                @click="removeInspection"
              ></el-button>
            </div>
            <el-tree
              class="qualityItemTree"
              :option="treeOption"
              highlight-current="true"
              :default-expanded-keys="expandedKeys"
              ref="treeProperties"
              :data="treeData"
              @node-click="nodeClick"
              node-key="id"
            ></el-tree>
            <el-dialog append-to-body :visible.sync="showInspectionDialog" width="30%" :fullscreen="fullscreenInspectionDialog">
              <div slot="title">
                {{ inspectionTitle
                }}<i
                  class="el-dialog__close fill-screen-icon"
                  :class="fullscreenInspectionDialog ? 'el-icon-news' : 'el-icon-full-screen'"
                  @click="fullscreenInspectionDialog = !fullscreenInspectionDialog"
                ></i>
              </div>
              <avue-form ref="inspectionProperties" v-model="inspectionModel" :option="inspectionOption"> </avue-form>
              <div slot="footer">
                <el-button
                  type="primary"
                  size="small"
                  :icon="inspectionTitle == '添加检验项' ? 'el-icon-circle-plus-outline' : 'el-icon-circle-check'"
                  @click="submitInspection"
                  v-preventReClick
                  >{{ inspectionTitle == '添加检验项' ? '保 存' : '修 改' }}</el-button
                >
                <el-button size="small" icon="el-icon-circle-close" @click="cancelInspection">取 消</el-button>
              </div>
            </el-dialog>
          </el-tab-pane>
        </el-tabs>
      </el-col>
      <!-- <el-col :span="1"></el-col> -->
      <el-col :span="20">
        <!-- <div style="margin-left: 10px"> -->
        <!-- <div><span style="color: #1c8afe; font-size: 12px">检验项明细</span></div> -->
        <avue-crud
          :option="option"
          :table-loading="loading"
          v-model="form"
          :data="itemData"
          :page.sync="page"
          :permission="permissionList"
          :before-open="beforeOpen"
          ref="crud"
          @search-change="searchChange"
          @search-reset="searchReset"
          @selection-change="selectionChange"
          @current-change="currentChange"
          @size-change="sizeChange"
          @refresh-change="refreshChange"
          @on-load="onLoad"
        >
          <template slot="menuRight">
            <user-table-config :option="option" @confirm="(val) => handleSetUserConfig(val, pageCode)"></user-table-config>
          </template>
          <template slot="menuLeft">
            <el-button type="primary" :disabled="!this.inspectionId" size="small" icon="el-icon-plus" v-if="permission.inspection_item_add" @click="addAttribute()"
              >添加</el-button
            >
            <el-button type="danger" :disabled="!this.inspectionId" size="small" icon="el-icon-delete" v-if="permission.inspection_item_del" @click="deleteAttribute()"
              >删 除
            </el-button>
            <el-button type="success" size="small" icon="el-icon-upload2" v-if="permission.qualityItemManage_import" @click="importConfig.show = true">导入</el-button>
            <el-button type="warning" size="small" icon="el-icon-download" :disabled="!this.inspectionId" v-if="permission.inspection_export" @click="handleExport"
              >导出
            </el-button>
          </template>

          <template slot="menu" slot-scope="{ row }">
            <el-button type="text" icon="el-icon-view" size="small" v-if="permission.inspection_item_view" @click="viewAttribute(row.id)">详情</el-button>
            <el-button type="text" icon="el-icon-edit" size="small" v-if="permission.inspection_item_edit" @click="updateAttribute(row.id)">编辑</el-button>
          </template>
        </avue-crud>
        <el-dialog append-to-body :visible.sync="showAttributeDialog" width="60%" :fullscreen="fullscreenAttributeDialog">
          <div slot="title">
            {{ attributeTitle }}
            <i
              class="el-dialog__close fill-screen-icon"
              :class="fullscreenAttributeDialog ? 'el-icon-news' : 'el-icon-full-screen'"
              @click="fullscreenAttributeDialog = !fullscreenAttributeDialog"
            ></i>
          </div>
          <avue-form ref="attributeProperties" v-model="attributeModel" :option="attributeOption">
            <template slot="imgUpload">
              <el-upload
                ref="fileUpload"
                class="upload-demo"
                drag
                action="/api/blade-resource/oss/endpoint/put-file-attach"
                accept="image/png, image/jpeg, image/jpg"
                list-type="picture"
                :file-list="fileList"
                :headers="headersObj"
                :on-remove="removeFile"
                :on-success="pictureUploadSuccess"
                :before-upload="beforeUpload"
              >
                <i class="el-icon-upload"></i>
                <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
              </el-upload>
            </template>
            <template slot="controlType">
              <div class="group-title"><i class="el-icon-vertical-bar avue-group__icon" style="cursor: not-allowed"></i>控件配置</div>
              <div style="width: 35vw">
                <div style="display: inline-block; margin: 0 30px 20px 10px; font-weight: bold; color: #606266">
                  <span>控件类型: </span>
                </div>
                <div style="display: inline-block">
                  <el-select :disabled="disabledAttributeControl" @change="changeControlType" v-model="attributeModel.controlType.type" clearable placeholder="请选择">
                    <el-option v-for="item in controlTypes" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"> </el-option>
                  </el-select>
                </div>
                <el-row style="margin-bottom: 20px">
                  <el-col :span="14">
                    <div v-if="attributeModel.controlType.type === 'SCAN'">
                      <el-col :span="6"> <label style="color: #f56c6c">*</label>识别规则: </el-col>
                      <el-col :span="14">
                        <el-input
                          placeholder="请输入内容"
                          v-model="attributeModel.recognitionDefinitionName"
                          class="input-with-select"
                          :disabled="attributeTitle === '检验明细项详情'"
                        >
                          <el-button slot="append" icon="el-icon-search" @click="openSequenceModal()" :disabled="attributeTitle === '检验明细项详情'"></el-button>
                        </el-input>
                      </el-col>
                    </div>
                  </el-col>
                </el-row>
                <div style="margin-left: 10px">
                  <el-row>
                    <el-col :span="16">
                      <div v-for="(item, index) in attributeModel.controlType.options" :key="index">
                        <el-row style="margin-bottom: 10px" v-if="attributeModel.controlType.type === 'SELECT'">
                          <el-col :span="10" style="margin-right: 30px">
                            <el-input :disabled="disabledAttributeControl" placeholder="请输入内容" v-model="item.label" clearable> </el-input>
                          </el-col>
                          <el-col :span="11">
                            <el-input placeholder="请选择下拉框内容" v-model="item.dictName" class="input-with-select" :disabled="attributeTitle === '检验明细项详情'">
                              <el-button slot="append" icon="el-icon-search" @click="openDictModal(index)" :disabled="attributeTitle === '检验明细项详情'"></el-button>
                            </el-input>
                          </el-col>
                          <el-col :span="1">
                            <i style="margin-left: 10px" class="el-icon-delete delete-controlType" @click="deletecontrolType(index)"></i>
                          </el-col>
                        </el-row>

                        <el-row style="margin-bottom: 10px" v-if="attributeModel.controlType.type === 'SINGLE-INPUT' || attributeModel.controlType.type === 'MULTIPLE-INPUT'">
                          <el-col :span="10" style="margin-right: 30px">
                            <el-input :disabled="disabledAttributeControl" placeholder="请输入内容" v-model="item.label" clearable> </el-input>
                          </el-col>
                          <el-col :span="11">
                            <el-select :disabled="disabledAttributeControl" v-model="item.type" placeholder="请选择输入框类型">
                              <el-option v-for="item in inputTypes" :key="item.value" :label="item.label" :value="item.value"> </el-option>
                            </el-select>
                          </el-col>
                          <el-col :span="1">
                            <i style="margin-left: 10px" class="el-icon-delete delete-controlType" @click="deletecontrolType(index)"></i>
                          </el-col>
                        </el-row>
                        <el-row style="margin-bottom: 10px" v-if="attributeModel.controlType.type === 'RADIO'">
                          <el-col :span="14" style="margin-right: 20px">
                            <el-input :disabled="disabledAttributeControl" placeholder="请输入内容" v-model="item.label" clearable> </el-input>
                          </el-col>
                          <el-col :span="8">
                            <el-row>
                              <el-col :span="2">
                                <el-radio label=""></el-radio>
                              </el-col>
                              <el-col :span="7">
                                <span style="padding-left: 10px"> {{ item.realLabel }}</span>
                                <!-- <el-input maxlength="15" placeholder="判断1" :disabled="disabledAttributeControl" v-model="item.realLabel" clearable> </el-input> -->
                              </el-col>
                              <el-col :span="2" style="margin-left: 10px">
                                <el-radio label=""></el-radio>
                              </el-col>
                              <el-col :span="7">
                                <span style="padding-left: 10px"> {{ item.shamLabel }}</span>
                                <!-- <el-input maxlength="15" placeholder="判断2" :disabled="disabledAttributeControl" v-model="item.shamLabel" clearable> </el-input> -->
                              </el-col>
                              <el-col :span="3">
                                <i style="margin-left: 10px" class="el-icon-delete delete-controlType" @click="deletecontrolType(index)"></i>
                              </el-col>
                            </el-row>
                          </el-col>
                        </el-row>
                      </div>
                      <template
                        v-if="
                          attributeModel.controlType.type === 'SINGLE-INPUT' ||
                          attributeModel.controlType.type === 'RADIO' ||
                          attributeModel.controlType.type === 'MULTIPLE-INPUT' ||
                          attributeModel.controlType.type === 'SELECT'
                        "
                      >
                        <div style="color: #009dd9; font-size: 12px; cursor: pointer">
                          <i class="el-icon-circle-plus-outline" @click="addOption(attributeModel.controlType.type)">
                            {{ attributeModel.controlType.type | filterType }}
                          </i>
                        </div>
                      </template>
                    </el-col>
                    <el-col :span="7" style="margin-left: 10px" v-if="attributeModel.controlType.type">
                      <el-row style="width: 15vw">
                        <el-col :span="4"><span style="color: #b0b0b0">示例：</span></el-col>
                        <template v-if="attributeModel.controlType.type === 'SINGLE-INPUT'">
                          <el-col :span="6"> 检验数量: </el-col>
                          <el-col :span="14">
                            <el-input readonly placeholder="请输入内容"></el-input>
                          </el-col>
                        </template>

                        <template v-if="attributeModel.controlType.type === 'MULTIPLE-INPUT'">
                          <el-col :span="6"> 测试值: </el-col>
                          <el-col :span="14">
                            <el-input readonly placeholder="请输入内容"></el-input>
                          </el-col>
                        </template>
                        <template v-if="attributeModel.controlType.type === 'RADIO'">
                          <el-col :span="10"> 是否按检验标准: </el-col>
                          <el-col :span="10">
                            <el-radio label="">是</el-radio>
                            <el-radio label="">否</el-radio>
                          </el-col>
                        </template>
                        <template v-if="attributeModel.controlType.type === 'SCAN'">
                          <el-col :span="6"> 扫码: </el-col>
                          <el-col :span="14" style="display: flex">
                            <el-input readonly placeholder="请输入内容"></el-input>
                            <i class="iconfont icon-iconfontscan" style="margin-left: 13px"></i>
                          </el-col>
                        </template>
                        <template v-if="attributeModel.controlType.type === 'SELECT'">
                          <el-col :span="6"> 性别: </el-col>
                          <el-col :span="14" style="display: flex">
                            <el-select v-model="attributeModel.sex" placeholder="请选择">
                              <el-option key="男" label="男" value="男"> </el-option>
                              <el-option key="女" label="女" value="女"> </el-option>
                            </el-select>
                          </el-col>
                        </template>
                      </el-row>
                      <el-row style="width: 15vw; margin-top: 5px">
                        <template v-if="attributeModel.controlType.type === 'SINGLE-INPUT'">
                          <el-col :span="10"> <span style="float: right; margin-right: 5px">不良数量:</span> </el-col>
                          <el-col :span="14">
                            <el-input readonly placeholder="请输入内容"></el-input>
                          </el-col>
                        </template>
                      </el-row>
                      <div style="margin-left: 25%; color: #009dd9; font-size: 12px">
                        <template>
                          <el-button type="text" @click="openExample"> 查看页面示例</el-button>
                        </template>
                      </div>
                    </el-col>
                  </el-row>
                </div>
              </div>
            </template>
          </avue-form>
          <div slot="footer">
            <el-button
              type="primary"
              v-if="attributeCode != 'view'"
              size="small"
              :icon="attributeCode == 'add' ? 'el-icon-circle-plus-outline' : 'el-icon-circle-check'"
              @click="submitAttribute"
              v-preventReClick
              >{{ attributeCode == 'add' ? '保 存' : '修 改' }}</el-button
            >
            <el-button v-if="attributeCode != 'view'" size="small" icon="el-icon-circle-close" @click="cancelAttribute">取 消</el-button>
          </div>
        </el-dialog>
        <!-- </div> -->
      </el-col>
    </el-row>
    <common-modal-template ref="commonModalTemplate" :option="tableOption" @getSelectedRows="getSelectedRows" :key="timer" @newKey="newKey"></common-modal-template>
    <importDialogComp
      title="检验项导入"
      :exportCode="importConfig.exportCode"
      :url="importConfig.url"
      :export-name="'检验项导入.xlsx'"
      :anotherExportMethod="true"
      :visible.sync="importConfig.show"
      @submit="codeClose"
    ></importDialogComp>
    <!--      :mapFields="['testType', 'operationType', 'controlTypeLabel']"-->
    <export-excel
      ref="exportExcel"
      url="/api/mes-product/qms-inspection-item-attribute/export"
      :option="option"
      name="检验项明细"
      :post="{ itemId: inspectionId, attributeName }"
    ></export-excel>
  </basic-container>
</template>

<script>
import {
  getInspectionitemTree,
  getInspectionitemattributeList,
  getControlType,
  addInspectionitem,
  removeInspectionitem,
  getInspectionitemattributeDetail,
  addOrUpdateInspection,
  delInspection,
  getInspectionDetail,
  getQCType
} from '@/api/quality/quality-manage';
import { mapGetters } from 'vuex';
import { validatenull } from '@/util/validate';
import importDialogComp from '@/components/dialog/import/index.vue';
import exportExcel from '@/components/export-excel/exp.vue';
import CommonModalTemplate from '@/components/common-modal-template/common-modal-template.vue';
import website from '@/config/website';
import { getToken } from '@/util/auth';
import { compressImg } from '@/util/compressImg';
import userTableConfig from '@/components/user-table-config';
import userConfig from '@/mixins/userConfig';

export default {
  components: {
    CommonModalTemplate,
    importDialogComp,
    exportExcel,
    userTableConfig
  },
  mixins: [userConfig()],
  filters: {
    filterType(type) {
      switch (type) {
        case 'SINGLE-INPUT':
          return '添加输入项';
        case 'RADIO':
          return '添加判断项';
        case 'MULTIPLE-INPUT':
          return '添加输入框';
        case 'MULTIPLE-INPUT':
          return '添加输入框';
        case 'SELECT':
          return '添加下拉框';
        default:
          break;
      }
    }
  },
  data() {
    const operationTypes = [
      {
        label: '人员',
        value: 'PERSONNEL'
      },
      {
        label: '机器',
        value: 'MACHINE'
      },
      {
        label: '材料',
        value: 'MATERIAL'
      },
      {
        label: '方法',
        value: 'METHOD'
      },
      {
        label: '测量',
        value: 'MEASURE'
      },
      {
        label: '环境',
        value: 'ENVIRONMENT'
      }
    ];
    const testTypes = [
      {
        label: '正常',
        value: 'NORMAL'
      },
      {
        label: '主要',
        value: 'MAJOR'
      },
      {
        label: '次要',
        value: 'MINOR'
      }
    ];
    const inspectionTypes = [
      {
        label: 'IQC',
        value: 'IQC'
      },
      {
        label: 'OQC',
        value: 'OQC'
      },
      {
        label: 'IPQC',
        value: 'IPQC'
      },
      {
        label: 'FQC',
        value: 'FQC'
      }
    ];
    return {
      pageCode: 'QUALITY_ITEM_MANAGE',
      importConfig: {
        show: false,
        url: '/api/mes-admin/excelimportconfig/import/code/qc_inspection_item_attribute',
        exportUrl: '',
        exportCode: 'qc_inspection_item_attribute'
      },
      form: {},
      modalName: '',
      timer: null,
      tableOption: {},
      fullscreenInspectionDialog: false, //检验项是否全屏
      fullscreenAttributeDialog: false, //检验项明细是否全屏
      inspectionTitle: '',
      treeSerchObj: {
        itemId: '', //检验项id
        itemName: ''
      },
      fileList: [],
      treeTypes: [],
      showInspectionDialog: false,
      expandedKeys: [], //树形默认展开节点
      inspectionModel: {
        itemType: '',
        itemName: '',
        code: ''
      }, //检查项对象，
      inspectionOption: {
        emptyBtn: false,
        submitBtn: false,
        column: [
          {
            label: '检验项类型',
            prop: 'itemType',
            labelWidth: 100,
            span: 24,
            // type: 'select',
            // dicData: inspectionTypes,
            disabled: true,
            rules: [
              {
                required: true,
                message: '请选择检验项类型',
                trigger: 'blur'
              }
            ]
          },
          {
            label: '检验项名称',
            prop: 'itemName',
            labelWidth: 100,
            span: 24,
            type: 'input',
            rules: [
              {
                required: true,
                message: '请输入检验项名称',
                trigger: 'blur'
              }
            ]
          },

          {
            label: '检验项编码',
            span: 24,
            labelWidth: 100,
            prop: 'code',
            rules: [
              {
                required: true,
                message: '请输入检验项编码',
                trigger: 'blur'
              }
            ]
          }
        ]
      },
      inspectionId: '', //检查项id
      controlTypes: [], //控件类型
      itemId: '',
      itemType: '',
      disabledAttributeControl: false,
      treeData: [],
      treeOption: {
        nodeKey: 'id',
        lazy: false,
        menu: false,
        filter: false,
        size: 'small',
        props: {
          labelText: '标题',
          label: 'label',
          value: 'value',
          children: 'children'
        }
      },
      itemData: [],
      storeItemData: [],
      inputTypes: [
        {
          label: '数字框',
          value: 'number'
        },
        {
          label: '文本框',
          value: 'string'
        }
      ],
      controlTypeOptions: {
        //存储不同类型组件options
        inputOptions: [],
        radioOptions: [],
        multipleOptions: [],
        scanOptions: [],
        selectOptions: []
      },
      attributeName: '',
      option: {
        height: 'calc(100vh - 382px)',
        calcHeight: 30,
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        border: true,
        index: true,
        indexLabel: '序号',
        addBtn: false,
        delBtn: false,
        viewBtn: false,
        editBtn: false,
        selection: true,
        dialogClickModal: false,
        labelWidth: 120,
        searchLabelWidth: 90,
        menuWidth: 200,
        columnBtn: false,
        column: [
          {
            label: '检验项明细',
            prop: 'attributeName',
            search: true,
            searchSpan: 6
          },
          {
            label: '明细项编码',
            prop: 'code'
          },
          {
            label: '检验标准',
            prop: 'testCriterion',
            rules: [
              {
                required: true,
                message: '请输入物料编码',
                trigger: 'blur'
              }
            ]
          },
          {
            label: '单位',
            prop: 'unit'
          },
          {
            label: '检验类型',
            prop: 'testType',
            type: 'select',
            dicData: testTypes
          },
          {
            label: '质量因素',
            prop: 'operationType',
            type: 'select',
            width: 80,
            dicData: operationTypes
          },
          {
            label: '检验方式',
            prop: 'testRecordType',
            dicData: [
              {
                label: '检验',
                value: 'INSPECTION'
              },
              {
                label: '测试',
                value: 'TEST'
              }
            ],
            rules: [
              {
                required: true,
                message: '请输入检验方式',
                trigger: 'blur'
              }
            ]
          },
          {
            label: '检验工具',
            prop: 'testTool',
            rules: [
              {
                required: true,
                message: '请输入检验工具',
                trigger: 'blur'
              }
            ]
          },
          {
            label: '控件类型',
            prop: 'controlType',
            width: 120
          },
          {
            label: '备注',
            prop: 'remark'
          }
        ]
      },
      loading: true,
      attributeTitle: '',
      attributeIds: [],
      attributeCode: '', //判断为编辑、增加、查看
      showAttributeDialog: false,
      attributeModel: {
        controlType: {
          type: '',
          options: []
        }
      }, //检验项对象
      //检验项配置
      attributeOption: {
        emptyBtn: false,
        submitBtn: false,
        label: '基本信息',
        icon: 'el-icon-vertical-bar',
        arrow: false,
        column: [
          {
            label: '检验项明细',
            prop: 'attributeName',
            labelWidth: 100,
            maxlength: 200,
            span: 8,
            type: 'input',
            rules: [
              {
                required: true,
                message: '请输入检验项明细',
                trigger: 'blur'
              }
            ]
          },
          {
            label: '明细项编码',
            prop: 'code',
            labelWidth: 100,
            span: 8,
            maxlength: 50,
            type: 'input',
            rules: [
              {
                required: true,
                message: '请输入明细项编码',
                trigger: 'blur'
              }
            ]
          },

          {
            label: '检验类型',
            span: 8,
            type: 'select',
            dicData: testTypes,
            prop: 'testType'
          },
          {
            label: '检验标准',
            prop: 'testCriterion',
            span: 8,
            maxlength: 15,
            type: 'input'
          },
          {
            label: '单位',
            prop: 'unit',
            span: 8
          },
          {
            label: '质量因素',
            span: 8,
            prop: 'operationType',
            type: 'select',
            dicData: operationTypes
          },
          {
            label: '检验方式',
            span: 8,
            prop: 'testRecordType',
            type: 'select',
            dicData: [
              {
                label: '检验',
                value: 'INSPECTION'
              },
              {
                label: '测试',
                value: 'TEST'
              }
            ]
          },
          {
            label: '检验工具',
            span: 8,
            prop: 'testTool',
            maxlength: 50
          },
          {
            label: '备注/原因',
            prop: 'remark',
            span: 24,
            type: 'textarea',
            maxRows: 3,
            minRows: 3,
            maxlength: 50
          },
          {
            label: '',
            span: 24,
            labelWidth: 0,
            formslot: true,
            prop: 'imgUpload'
          },
          {
            label: '',
            span: 24,
            labelWidth: 0,
            formslot: true,
            prop: 'controlType'
          }
        ]
      }
    };
  },
  watch: {
    attributeCode(val) {
      this.disabledAttributeControl = val === 'view';
    }
  },
  computed: {
    ...mapGetters(['permission']),
    headersObj() {
      let header = { Authorization: `Basic ${Base64.encode(`${website.clientId}:${website.clientSecret}`)}` };
      header['Blade-Auth'] = 'bearer ' + getToken();
      return header;
    },
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.inspection_item_add, false),
        viewBtn: this.vaildData(this.permission.inspection_item_view, false),
        delBtn: this.vaildData(this.permission.inspection_item_del, false),
        editBtn: this.vaildData(this.permission.inspection_item_edit, false)
      };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
        ids.push(ele.id);
      });
      return ids.join(',');
    }
  },
  methods: {
    removeFile(file) {
      this._forEach(this.fileList, (item, index) => {
        if (item.attachmentId === file.attachmentId) {
          this.fileList.splice(index, 1);
        }
      });
    },
    pictureUploadSuccess(res) {
      this.fileList.push({
        attachmentId: res.data.attachId,
        link: res.data.link,
        url: res.data.link,
        name: res.data.originalName
      });
    },
    beforeUpload(file) {
      return new Promise(async (resolve, reject) => {
        if (!file.type.includes('image')) {
          this.$message.warning('请上传图片');
          reject(new Error('请上传图片'));
          return;
        }
        if (file.type != 'image/png' && file.type != 'image/jpeg') {
          this.$message.warning('请上传正确的文件类型！');
          reject(new Error('请上传正确的文件类型！'));
          return;
        }
        try {
          const newFile = await compressImg(file);
          resolve(newFile);
        } catch (e) {
          console.log(e);
        }
      });
    },
    searchChange(params, done) {
      this.attributeName = params.attributeName;
      if (!params.attributeName) {
        this.itemData = this._cloneDeep(this.storeItemData);
      } else {
        this.itemData = this.storeItemData.filter((item) => {
          let index = item.attributeName.indexOf(params.attributeName);
          return index >= 0;
        });
      }
      done();
    },

    searchReset() {
      this.itemData = this._cloneDeep(this.storeItemData);
    },

    /**
     * 查询数据字典控件类型
     */
    getControlTypes() {
      getControlType()
        .then((res) => {
          if (res.data.code === 200) {
            this.controlTypes = res.data.data;
          }
        })
        .catch((err) => {});
    },
    //id为默认展开的id
    initTree(id) {
      this.treeData = [];
      getInspectionitemTree().then((res) => {
        this.treeData = (res.data.data || []).map((item) => {
          let children = (item.itemList || []).map((itemChild) => {
            return {
              id: itemChild.id,
              label: itemChild.itemName,
              value: itemChild,
              leaf: true
            };
          });

          let treeItem = {
            leaf: false,
            value: item.itemType,
            label: item.itemType,
            // id: item.dict.id,
            children
          };
          return treeItem;
        });

        this.$nextTick(() => {
          id ? (this.expandedKeys = [].concat([id])) : [];
          this.$refs.treeProperties.setCurrentKey(`${id}`);
        });
      });
    },
    nodeClick(data) {
      if (data.leaf) {
        this.$refs.crud.searchReset();
        this.attributeName = '';
        this.inspectionId = data.value.id;
        this.attributeModel.itemId = data.value.id;
        this.itemId = data.value.id;
        this.inspectionModel.itemType = data.value.itemType;
        this.getLists(data.value.id);
      } else {
        this.inspectionModel.itemType = data.value.dictKey || data.value;
        this.inspectionId = '';
        this.itemId = '';
      }
    },
    addChildren() {
      if (validatenull(this.regionForm.code) || validatenull(this.regionForm.name)) {
        this.$message.warning('请先选择一项区划');
        return;
      }
      this.regionForm.parentCode = this.regionForm.code;
      this.regionForm.parentName = this.regionForm.name;
      this.regionForm.code = '';
      this.regionForm.subCode = '';
      this.regionForm.name = '';
      this.regionForm.regionLevel = this.regionForm.regionLevel === 5 ? 5 : this.regionForm.regionLevel + 1;
    },

    beforeOpen(done, type) {
      done();
    },

    selectionChange(list) {
      this.attributeIds = list.map((item) => {
        return item.id;
      });
    },
    onLoad(page, params = {}) {
      this.loading = false;
    },
    /**
     * itemId:string，点击选中的检验项id
     */
    getLists(itemId) {
      let that = this;
      getInspectionitemattributeList({ itemId }).then((res) => {
        this.itemData = (res.data.data || []).map((item) => {
          item.controlType = typeof item.controlType === 'string' ? JSON.parse(item.controlType) : item.controlType;
          let controlType;
          if (item.controlType) {
            controlType = that.controlTypes.find((type) => type.dictKey === item.controlType.type);
          }
          item.controlType = (controlType && controlType.dictValue) || '';
          return item;
        });
        this.storeItemData = this._cloneDeep(this.itemData);
        this.loading = false;
      });
    },
    //增加检验项子项
    addAttribute() {
      this.fileList = [];
      this.attributeCode = 'add';
      this.attributeTitle = '添加检验明细项';
      this.showAttributeDialog = true;
      this.fullscreenAttributeDialog = false;
      this.disabledAttribute(false);
      this.controlTypeOptions = Object.assign(
        {},
        {
          //存储不同类型组件options
          inputOptions: [],
          radioOptions: [],
          multipleOptions: [],
          scanOptions: [],
          selectOptions: []
        }
      );
      this.$nextTick(() => {
        // this.$refs.attributeProperties.resetForm();
        this.attributeModel = Object.assign(
          {},
          {
            attributeName: '',
            code: '',
            testType: '',
            testCriterion: '',
            operationType: '',
            testRecordType: '',
            testRecordType: '',
            testTool: '',
            remark: '',
            controlType: {
              type: '',
              options: []
            }
          }
        );
      });
    },
    updateAttribute(id) {
      this.fileList = [];
      this.attributeCode = 'edit';
      this.controlTypeOptions = Object.assign(
        {},
        {
          //存储不同类型组件options
          inputOptions: [],
          radioOptions: [],
          multipleOptions: [],
          scanOptions: [],
          selectOptions: []
        }
      );
      this.fullscreenAttributeDialog = false;
      this.findAttribute(id, 'edit');
    },
    openExample() {
      let showHtml = '';
      switch (this.attributeModel.controlType.type) {
        case 'SINGLE-INPUT':
          showHtml = ` <div><span>检验数量：</span> <div style="display:inline-block;float: right;font-size: 12px">请输入</div></div>
          <div><span>不良数量：</span> <div style="display:inline-block;float: right;font-size: 12px">请输入</div></div>`;
          break;
        case 'MULTIPLE-INPUT':
          showHtml = `<div><span>测试值：</span> <input/> <button style="background-color: #169bd5;color: #ffffff;border: 1px solid;margin-left:15px;border-radius:5px">确定</button></div>
         <div style="margin: 10px 0">   <table border="1">
    <tr>
        <th width=50 style="text-align: center">次数</th>
        <th width=70 style="text-align: center">测试值</th>
          <th width=120 style="text-align: center">测试结果</th>
          <th width=70 style="text-align: center">操作</th>
    </tr>
    <tr>
        <td style="text-align: center">1</td>
        <td style="text-align: center">12</td>
        <td style="text-align: center">
        <span><input checked type="radio"/>OK</span> <span><input type="radio"/>NG</span>
        </td>
          <td style="text-align: center;color:red"><div>x</div></td>
    </tr>
</table></div>`;
          break;
        case 'RADIO':
          showHtml = `<div><span>是否按标准检验:</span>   <div style="display:inline-block;margin-left: 21%">  <span style="margin-right: 20px"><input type="radio"/>是</span> <span><input type="radio"/>否</span></div></div>`;
          break;
        case 'SCAN':
          showHtml = `<div style="display: contents;"><span>扫码：</span> <input/></div>
          <i class="iconfont icon-iconfontscan" style="margin-left: 13px"></i>`;
          break;
        case 'SELECT':
          showHtml = `<div style="display: contents;"><span>性别：</span>
          <select style="color: #ccc">
            <option>请选择</option>
            <option>男</option>
            <option>女</option>
   	      </select></div>`;
          break;
      }
      this.$alert(
        `<div><span>检验项：外观情况</span></div>
         <div><span>检验明细项：划伤/变形/裂痕/松动</span></div>
         <div><span>检验标准：无伤痕、无变形、无裂痕、无松动</span></div>
         <div><span>检验工具：目测</span></div>
         ${showHtml}
          <div><span>检验结果：</span>   <div style="display:inline-block;margin-left: 29%">  <span style="margin-right: 20px"><input checked type="radio"/>OK</span> <span><input type="radio"/>NG</span></div></div>`,
        '',
        {
          dangerouslyUseHTMLString: true,
          showConfirmButton: false
        }
      );
    },
    //删除检验项子项
    deleteAttribute() {
      if (this.attributeIds.length > 0) {
        this.$confirm(`确定将数据删除?`, {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          removeInspectionitem(this.attributeIds).then((res) => {
            this.$message({
              type: 'success',
              message: '删除成功!'
            });
            this.getLists(this.inspectionId);
          });
        });
      }
    },

    findAttribute(id, type) {
      this.fileList = [];
      getInspectionitemattributeDetail({ id }).then((res) => {
        this.attributeModel = res.data.data;
        if (this.attributeModel.controlType) {
          this.attributeModel.controlType = JSON.parse(this.attributeModel.controlType);
        }

        if (this.attributeModel.attachUrls && this.attributeModel.attachUrls.length > 0) {
          let attachUrls = this.attributeModel.attachUrls.split(',');
          let attachIds = this.attributeModel.attachIds.split(',');
          // let attachNames = this.attributeModel.attachNames.split(',');
          for (let i = 0; i < attachIds.length; i++) {
            this.fileList.push({
              name: '',
              url: attachUrls[i],
              attachmentId: attachIds[i],
              link: attachUrls[i]
            });
          }
        }
        this.attributeTitle = type === 'edit' ? '修改检验明细项' : '检验明细项详情';
        this.showAttributeDialog = true;
        this.disabledAttribute(type === 'view');
      });
    },
    //是否禁止对子项输入
    disabledAttribute(flag) {
      this.$nextTick(() => {
        let option = this.$refs.attributeProperties.option;
        option.column = option.column.map((item) => {
          item.disabled = flag;
          return item;
        });
      });
    },

    viewAttribute(id) {
      this.fileList = [];
      this.attributeCode = 'view';
      this.fullscreenAttributeDialog = false;
      this.findAttribute(id, 'view');
    },
    //新增或修改子项
    async submitAttribute() {
      console.log();
      let attribute = this._cloneDeep(this.attributeModel);
      if (this.attributeCode == 'add') {
        delete attribute.id;
      }
      attribute.itemId = this.inspectionId;
      attribute.controlType = JSON.stringify(attribute.controlType);
      attribute.attachUrls = String(this._map(this.fileList, (item) => item.link));
      attribute.attachIds = String(this._map(this.fileList, (item) => item.attachmentId));
      // attribute.attachNames = String(this._map(this.fileList, (item) => item.name));
      let done;
      let validDate = await new Promise((resolve, reject) => {
        this.$refs.attributeProperties.validate((valid, done) => {
          done = done;
          if (valid) {
            resolve();
            done();
          } else {
          }
        });
      });
      Promise.all([validDate]).then(() => {
        addInspectionitem(attribute).then(
          () => {
            this.getLists(this.inspectionId);
            this.$message({
              type: 'success',
              message: '操作成功!'
            });
            this.showAttributeDialog = false;
            // this.$refs.attributeProperties.resetForm();
            this.$nextTick(() => {
              this.$refs.attributeProperties.resetForm();
              this.attributeModel = Object.assign(
                {},
                {
                  controlType: {
                    type: '',
                    options: []
                  }
                }
              );
              this.controlTypeOptions = Object.assign(
                {},
                {
                  //存储不同类型组件options
                  inputOptions: [],
                  radioOptions: [],
                  multipleOptions: [],
                  scanOptions: []
                }
              );
            });
          },
          (error) => {
            window.console.log(error);
          }
        );
        done();
      });
    },
    //取消
    cancelAttribute() {
      this.showAttributeDialog = false;
      // this.$refs.attributeProperties.resetForm();
      this.attributeModel = {
        controlType: {
          type: '',
          options: []
        }
      };
    },

    //添加控件类型的子项
    addOption(type) {
      if (this.attributeCode != 'view') {
        switch (type) {
          case 'SINGLE-INPUT':
            this.attributeModel.controlType.options.push({
              label: '',
              type: '',
              controlType: 'SINGLE-INPUT'
            });
            break;
          case 'RADIO':
            this.attributeModel.controlType.options.push({
              label: '',
              type: '',
              realLabel: '是',
              shamLabel: '否',
              controlType: 'RADIO'
            });
            break;
          case 'MULTIPLE-INPUT':
            this.attributeModel.controlType.options.push({
              label: '',
              type: '',
              controlType: 'MULTIPLE-INPUT'
            });
            break;
          case 'SELECT':
            this.attributeModel.controlType.options.push({
              label: '',
              type: '',
              controlType: 'SELECT'
            });
            break;
          default:
            break;
        }
        // type === 'SINGLE-INPUT'
        //   ? this.attributeModel.controlType.options.push({
        //       label: '',
        //       type: '',
        //       controlType: 'SINGLE-INPUT'
        //     })
        //   : this.attributeModel.controlType.options.push({
        //       label: '',
        //       type: '',
        //       realLabel: '是',
        //       shamLabel: '否',
        //       controlType: 'RADIO'
        //     });
      }
    },
    changeControlType(val) {
      let controlType =
        this.attributeModel.controlType.options && this.attributeModel.controlType.options.length > 0 ? this.attributeModel.controlType.options[0].controlType : '';
      console.log(this.controlTypeOptions, 333333333333);
      switch (controlType) {
        case 'SINGLE-INPUT':
          this.controlTypeOptions.inputOptions = this.attributeModel.controlType.options || [];
          break;
        case 'MULTIPLE-INPUT':
          this.controlTypeOptions.multipleOptions = this.attributeModel.controlType.options || [];
          break;
        case 'RADIO':
          this.controlTypeOptions.radioOptions = this.attributeModel.controlType.options || [];
          break;
        case 'SCAN':
          this.controlTypeOptions.scanOptions = this.attributeModel.controlType.options || [];
          break;
        case 'SELECT':
          this.controlTypeOptions.selectOptions = this.attributeModel.controlType.options || [];
          break;
      }
      switch (val) {
        case 'SINGLE-INPUT':
          this.controlTypeOptions.inputOptions.length == 0
            ? (this.attributeModel.controlType.options = [
                {
                  label: '',
                  type: '',
                  controlType: 'SINGLE-INPUT'
                }
              ])
            : (this.attributeModel.controlType.options = this._cloneDeep(this.controlTypeOptions.inputOptions));
          break;
        case 'MULTIPLE-INPUT':
          this.controlTypeOptions.multipleOptions.length == 0
            ? (this.attributeModel.controlType.options = [
                {
                  label: '',
                  type: '',
                  controlType: 'MULTIPLE-INPUT'
                }
              ])
            : (this.attributeModel.controlType.options = this._cloneDeep(this.controlTypeOptions.multipleOptions));
          break;
        case 'RADIO':
          this.controlTypeOptions.radioOptions.length == 0
            ? (this.attributeModel.controlType.options = [
                {
                  label: '',
                  type: '',
                  realLabel: '是',
                  shamLabel: '否',
                  controlType: 'RADIO'
                }
              ])
            : (this.attributeModel.controlType.options = this._cloneDeep(this.controlTypeOptions.radioOptions));
          break;
        case 'SCAN':
          this.controlTypeOptions.scanOptions.length == 0
            ? (this.attributeModel.controlType.options = [
                {
                  label: '扫码',
                  type: 'text',
                  controlType: 'SCAN'
                }
              ])
            : (this.attributeModel.controlType.options = this._cloneDeep(this.controlTypeOptions.scanOptions));
          break;
        case 'SELECT':
          this.controlTypeOptions.selectOptions.length == 0
            ? (this.attributeModel.controlType.options = [
                {
                  label: '',
                  type: 'text',
                  controlType: 'SELECT'
                }
              ])
            : (this.attributeModel.controlType.options = this._cloneDeep(this.controlTypeOptions.selectOptions));
          break;
        default:
          this.attributeModel.controlType.options = [];
          break;
      }
      console.log(this.attributeModel.controlType.options, 88888);
    },
    //增加检查项
    addInspection() {
      if (this.inspectionModel.itemType) {
        this.inspectionTitle = '添加检验项';
        this.showInspectionDialog = true;
        this.fullscreenInspectionDialog = false;
        this.inspectionModel.itemName = '';
        this.inspectionModel.code = '';
      }
    },
    //修改检查项
    updateInspection() {
      if (this.itemId) {
        this.fullscreenInspectionDialog = false;
        getInspectionDetail({ id: this.itemId }).then((res) => {
          this.inspectionModel = res.data.data;
          this.inspectionTitle = '修改检验项';
          this.showInspectionDialog = true;
        });
      }
    },
    //删除检查项
    removeInspection() {
      if (this.itemId) {
        this.$confirm(`确定将数据删除?`, {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          delInspection([this.itemId]).then((res) => {
            this.$message({
              type: 'success',
              message: '删除成功!'
            });
            this.itemData = [];
            this.storeItemData = [];
            this.initTree();
            this.itemId = '';
          });
        });
      }
    },
    //刷新树
    refreshInspection() {
      this.initTree();
      this.itemData = [];
      this.storeItemData = [];
      this.inspectionModel.itemType = '';
      this.inspectionId = '';
      this.itemId = '';
    },
    async submitInspection() {
      let attribute = this.inspectionModel;
      // attribute.parentId = this.inspectionId;
      let done;
      let validDate = await new Promise((resolve, reject) => {
        this.$refs.inspectionProperties.validate((valid, done) => {
          done = done;
          if (valid) {
            resolve();
            done();
          } else {
          }
        });
      });
      Promise.all([validDate]).then(() => {
        addOrUpdateInspection(attribute).then(
          (res) => {
            this.$message({
              type: 'success',
              message: '操作成功!'
            });
            // this.inspectionModel = {};
            Object.keys(this.inspectionModel).forEach((key) => {
              if (['itemType', 'itemName', 'code'].includes(key)) {
                this.inspectionModel[key] = '';
              } else {
                delete this.inspectionModel[key];
              }
            });
            this.initTree(attribute.id);
            if (!attribute.id) {
              this.itemData = []; //新增检查项
            } else {
              this.itemData = []; //TO DO 需要默认选中此节点
            }
            this.storeItemData = [];

            this.$refs.inspectionProperties.resetForm();
            this.showInspectionDialog = false;
          },
          (error) => {
            window.console.log(error);
          }
        );
        done();
      });
    },
    //删除某一项控件
    deletecontrolType(index) {
      this.attributeModel.controlType.options = this.attributeModel.controlType.options.filter((item, i) => index != i);
      this.attributeModel.controlType.options.length == 0 ? (this.attributeModel.controlType.type = '') : '';
    },
    cancelInspection() {
      this.showInspectionDialog = false;
    },
    // TO DO 目前未实现此方法，需要研究树如何触发默认选中
    serchTree() {
      if (this.treeSerchObj.itemId && this.treeSerchObj.itemName) {
        getInspectionDetail(this.treeSerchObj).then((res) => {
          if (res.data && res.data.data && res.data.data.id) {
            this.inspectionId = this.treeSerchObj.itemId;
            this.attributeModel.itemId = res.data.data.id;
            this.itemId = res.data.data.id;
            let treeType = this.treeTypes.find((item) => item.value === this.treeSerchObj.itemId);
            this.inspectionModel.itemType = (treeType && treeType.label) || '';
            this.getLists(this.itemId);
            this.$nextTick(() => {
              this.expandedKeys = [].concat([this.itemId]);
              this.$refs.treeProperties.setCurrentKey(`${this.itemId}`);
            });
          }
        });
      }
    },
    //清空树搜索条件展示默认
    clearSerch() {
      this.treeSerchObj = {
        itemId: '',
        itemName: ''
      };
      this.initTree();
      this.itemData = [];
      this.storeItemData = [];
      this.inspectionModel.itemType = '';
      this.inspectionId = '';
      this.itemId = '';
      this.expandedKeys = [];
    },
    //获取QC数据字典
    getQCTypes() {
      getQCType().then((res) => {
        res.data.data = res.data.data || [];
        this.treeTypes = res.data.data.map((item) => {
          return {
            label: item.dictValue,
            value: item.id
          };
        });
      });
    },

    getSelectedRows(row, title) {
      if (title === 'sequenceInfo') {
        this.attributeModel.recognitionDefinitionId = row.id;
        this.$set(this.attributeModel, 'recognitionDefinitionName', row.name);
      } else if (this.modalName === 'dictInfo') {
        this._forEach(this.attributeModel.controlType.options, (item, index) => {
          if (title === index) {
            item.dictCode = row.code;
            item.dictName = row.dictValue;
          }
        });
      }
    },
    /*
     * 打开系统模态框
     */
    openDictModal(i) {
      this.modalName = 'dictInfo';
      this.tableOption = {
        modalTitle: '选择系统规则信息（双击进行选择）',
        url: `/api/blade-system/dict/parent-list`,
        isPage: true,
        titleInfo: i,
        rowSelectionType: 'single',
        columnDefs: [
          {
            label: '字典编号',
            prop: 'code',
            search: true,
            slot: true,
            span: 24,
            rules: [
              {
                required: true,
                message: '请输入字典编号',
                trigger: 'blur'
              }
            ]
          },
          {
            label: '字典名称',
            prop: 'dictValue',
            search: true,
            align: 'center',
            rules: [
              {
                required: true,
                message: '请输入字典名称',
                trigger: 'blur'
              }
            ]
          },
          {
            label: '字典排序',
            prop: 'sort',
            type: 'number',
            align: 'right',
            width: 100,
            rules: [
              {
                required: true,
                message: '请输入字典排序',
                trigger: 'blur'
              }
            ]
          },
          {
            label: '封存',
            prop: 'isSealed',
            type: 'switch',
            align: 'center',
            width: 100,
            dicData: [
              {
                label: '否',
                value: 0
              },
              {
                label: '是',
                value: 1
              }
            ],
            value: 0,
            slot: true,
            rules: [
              {
                required: true,
                message: '请选择封存',
                trigger: 'blur'
              }
            ]
          },
          {
            label: '字典备注',
            prop: 'remark',
            hide: true
          }
        ]
      };
      this.$refs.commonModalTemplate.showModal();
    },

    /*
     * 打开序列号规则模态框
     */
    openSequenceModal() {
      this.tableOption = {
        modalTitle: '选择序列号规则信息（双击进行选择）',
        url: `/api/mes-admin/sequencedefinition/page`,
        isPage: true,
        titleInfo: 'sequenceInfo',
        rowSelectionType: 'single',
        columnDefs: [
          {
            label: '规则名称',
            prop: 'name',
            search: true,
            rules: [
              {
                required: true,
                message: '请输入序列号规则名称',
                trigger: 'blur'
              }
            ]
          },
          {
            label: '规则编码',
            prop: 'code',
            search: true,
            rules: [
              {
                required: true,
                message: '请输入序列号规则编码',
                trigger: 'blur'
              }
            ]
          },
          {
            label: '序列号规则',
            prop: 'sequenceNoFormat',
            labelslot: true,
            rules: [
              {
                required: true,
                message: '请输入序列号规则',
                trigger: 'blur'
              }
            ]
          },
          {
            label: '规则位数',
            prop: 'charactersCount',
            rules: [
              {
                required: false,
                message: '请输入序列号规则位数',
                trigger: 'blur'
              }
            ]
          }
        ]
      };
      this.$refs.commonModalTemplate.showModal();
    },
    /**
     * 重新加载公用表格弹窗组件
     */
    newKey() {
      this.timer = new Date().getTime();
    },
    codeClose(value) {
      if (value) {
        this.onLoad(this.page);
      }
    },
    handleExport() {
      this.$refs.exportExcel.visible = true;
    }
  },
  mounted() {
    this.$nextTick(() => {
      //搜索与表格结构分隔
      this.$structuralSplit();
    });

    this.initTree();
    this.getControlTypes();
    this.getQCTypes();
  }
};
</script>

<style scoped lang="scss">
$BORDER-STYLE: 1px solid #f0f0f0 !important;
.box {
  height: 800px;
}

.el-scrollbar {
  height: 100%;
}

.box .el-scrollbar__wrap {
  overflow: scroll;
}

.icon-inspection-item {
  font-size: 18px;
  padding: 5px 0;
}
.refresh-item {
  background: #00bcd4;
}

.add-item {
  background: #4caf50;
}

.edit-item {
  background: #077fc1;
}

.del-item {
  background: #f44336;
}

.refresh-item,
.add-item,
.edit-item,
.del-item {
  margin-right: 8px;
  cursor: pointer;
  color: #ffffff;
}
.delete-controlType:hover {
  cursor: pointer;
}
.btn-fab-mini {
  width: 27px;
  height: 27px;
  min-width: 27px;
}
.inspection-btn {
  border-radius: 4px;
  width: 27px;
  height: 27px;
  min-width: 27px;
  margin-left: 2px !important;
  background-color: #fff;
  padding: 0;
  overflow: hidden;
  position: relative;
  line-height: normal;
  border: 1px solid #dcdfe6;
  margin-right: 5px;
  box-shadow: 2px 2px 4px 0 rgb(0 0 0 / 12%), 0 0 6px 0 rgb(0 0 0 / 4%);
}
.refresh-btn {
  color: #00bcd4;
}
.add-btn {
  color: #4caf50;
}
.edit-btn {
  color: #077fc1;
}
.btn-disabled {
  color: #dedede;
}
.del-btn {
  color: #f44336 !important;
}
.btn-icon {
  margin-right: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #ffffff;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-12px, -12px);
  line-height: 24px;
  width: 24px;
  vertical-align: middle;
}
.ripple-container {
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

::v-deep .inspection-btn:hover {
  background-color: #dedede;
}
::v-deep .el-dialog__header {
  border-bottom: $BORDER-STYLE;
}

::v-deep .el-dialog__footer {
  border-top: $BORDER-STYLE;
}

.fill-screen-icon {
  color: #909399;
  font-size: 15px;
  float: right;
  padding-right: 25px;
  &:hover {
    color: #409eff;
  }
}

.group-title {
  border-bottom: 1px solid rgb(240, 240, 240) !important;
  font-size: 16px;
  font-weight: 500;
  height: 50px;
  line-height: 50px;
  color: rgba(0, 0, 0, 0.85);
  margin-bottom: 20px;
}

.qualityItemTree {
  height: calc(100vh - 265px);
  overflow: auto;
  border-top: 1px solid #cccccc;
}

::v-deep .el-tabs__item {
  color: #606266 !important;
  font-weight: bold;
}
::v-deep .el-tree-node__content {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  height: 30px;
  cursor: pointer;
  border: 1px solid #cccccc;
  border-top: none;
}
::v-deep .el-table {
  margin-bottom: 10px;
}
</style>
